<?php
class VoteController extends NodeController {
	
	/**
	 * 获取队列投票数 全部
	 *@return JSON
	 */
	public function tickets() {
		$tickets = self::getService ()->getAllTickets ();
		$this->sendNotice ( "success", $tickets, true );
	}
	
	/**
	 * 投票
	 */
	public function t() {
		$rs = self::getService ()->addTickets ( $_POST ['id'], $this->_user_global ['uid'] );
		if ($rs == self::SUCEESS) {
			self::getLogService ()->add ( $this->_user_global ['username'], "投票$_POST[id]成功" );
		} else {
			self::getLogService ()->add ( $this->_user_global ['username'], "投票$_POST[id]失败$rs" );
		}
		$this->sendNotice ( $rs, null, FALSE );
	}
	
	/**
	 * 获取投票服务类
	 * Enter description here ...
	 */
	public static function getService() {
		return new VoteService ();
	}
	

}